<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>编辑电影</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css">
</head>
<body>
    <nav class="navbar navbar-expand-lg navbar-dark bg-dark">
        <div class="container">
            <a class="navbar-brand" href="/">电影系统</a>
            <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
                <span class="navbar-toggler-icon"></span>
            </button>
            <div class="collapse navbar-collapse" id="navbarNav">
                <ul class="navbar-nav">
                    <li class="nav-item">
                        <a class="nav-link" href="/">首页</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="/movie/list">电影列表</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="/user/list">用户管理</a>
                    </li>
                </ul>
            </div>
        </div>
    </nav>

    <div class="container mt-4">
        <h2>编辑电影</h2>

        <form th:action="@{/movie/update}" method="post" th:object="${movie}">
            <input type="hidden" th:field="*{id}">

            <div class="mb-3">
                <label for="name" class="form-label">电影名称</label>
                <input type="text" class="form-control" id="name" th:field="*{name}" required>
            </div>

            <div class="mb-3">
                <label for="photo" class="form-label">电影海报URL</label>
                <input type="text" class="form-control" id="photo" th:field="*{photo}" required>
            </div>

            <div class="mb-3">
                <label for="types" class="form-label">电影类型</label>
                <input type="text" class="form-control" id="types" th:field="*{types}" required>
            </div>

            <div class="mb-3">
                <label for="price" class="form-label">价格</label>
                <input type="number" class="form-control" id="price" th:field="*{price}" step="0.01" required>
            </div>

            <div class="mb-3">
                <label for="description" class="form-label">电影简介</label>
                <textarea class="form-control" id="description" th:field="*{description}" rows="5" required></textarea>
            </div>

            <div class="mb-3">
                <button type="submit" class="btn btn-primary">保存修改</button>
                <a href="/movie/list" class="btn btn-secondary">取消</a>
            </div>
        </form>
    </div>

    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>
